#include <stdio.h>
#include <stdlib.h>
int main()
{
    int m = 0, n = 0;
    int sum1 = 0, sum2 = 0;
    scanf("%d", &m);
    int arr[501][501] = { 0 };
    for (int i = 0; i < m; i++) 
	{
        for (int j = 0; j < m; j++) 
		{
            scanf("%d", &arr[i][j]);
        }
    }
    for (int i = 0; i < m; i++)
	 {
        sum1 = 0;
        for (int j = 0; j < m; j++) 
		{
            n = i + j;
            if (n >= m)
                n %= m;
            sum1 += arr[j][n];
        }
        if (sum1 > sum2)
            sum2 = sum1;
    }
    printf("%d", sum2);
    return 0;
}
